package com.jblv.frame.web.config.JsonConfig;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @author happyonion.yangtao
 * @version 1.0
 * @title MyNullJsonSerializer
 * @projectName jblv-frame
 * @packageName com.jblv.frame.user.service.config.JsonConfig
 * @description MyNullJsonSerializer 处理字符串等类型的null值
 * @date Create at 2020/5/20 22:07
 * @since jdk1.8
 */
public class MyNullJsonSerializer extends JsonSerializer {

    @Override
    public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
            throws IOException, JsonProcessingException {
        jsonGenerator.writeString("");
    }
}
